package br.com.controleVendas.controller;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

import org.primefaces.context.RequestContext;

@ManagedBean(name = "utilsCtrl")
@SessionScoped
public class UtilsController
{

	public UtilsController() {
		System.out.println(getUrl());
	}
	
    public String getUrl()
    {
        String url = RequestContext.getCurrentInstance().isSecure() ? "https://" : "http://";
        url += FacesContext.getCurrentInstance().getExternalContext().getRequestServerName();
        url += FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
        return url;
    }
}
